﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title>驰骋工作流</title>
    <script language="JavaScript" src="../../Comm/JScript.js" type="text/javascript" ></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet"  type="text/css" />

    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>

    <script type="text/javascript" language="javascript" >
        //页面启动函数.
        $(function () {

            $("#Msg").html("正在加载,请稍后......");

            InitPage();

            $("#Msg").html("");
        });
        //初始化数据.
        function InitPage() {

            var fk_node = GetQueryString("FK_Node");

            var node = new Entity("BP.WF.Node", fk_node);

            //调用公共类库的方法:执行批量主表赋值.
           // GenerBindEnumKey("DDL_BRole", "BatchRole", node.BatchRole);

            //获得属性集合.
            var attrs = new Entities("BP.Sys.MapAttrs");
            attrs.Retrieve("FK_MapData", "ND" + fk_node);

            //增加处理.
            for (var i = 0; i < attrs.length; i++) {

                var item = attrs[i];
                var newRow = "";
                newRow = "<tr ><td class=Idx>" + i + "</td>";
                if (data.BatchParas.indexOf(item.KeyOfEn) > -1) {
                    newRow += "<td>" + "<input name='CB_Node' type='checkbox' value='" + item.KeyOfEn + "' checked='checked' />" + item.KeyOfEn + "</td>";
                } else {
                    newRow += "<td>" + "<input name='CB_Node' type='checkbox' value='" + item.KeyOfEn + "' />" + item.KeyOfEn + "</td>";
                }
                newRow += "<td>" + item.Name + "</td>";
                newRow += "<td>" + item.LGTypeText + "</td>";
                newRow += "</tr>";
                $("#table1 tr:last").after(newRow);
            }
            return;
        }


        //ajax 提交
        function Btn_Save_Click() {
            var checkBoxIDs = GenerCheckIDs(); //获得所有的 checkBox ID传入到后台去,用于解决checkbox控件，在没有被选择的时候，没有值的问题。
            var frmData = $("#cc").serialize();
            //alert(frmData);
            $.ajax({
                data: frmData,
                type: 'post',
                async: true,
                url: Handler + "?DoType=BatchStartFields_Save&CheckBoxIDs=" + checkBoxIDs + "&FK_Node=" + GetQueryString("FK_Node") + "&m=" + Math.random(),
                dataType: 'html',
                success: function (data) {
                    if (data.indexOf('err@') >= 0) {
                        alert(data);
                        return;
                    }
                    alert(data);
                    window.location.href = window.location.href;
                    return;
                }
            });
        }
    </script>
</head>
<body  >

<form id="cc">
 
 <table style="width: 70%;">
        <caption>批量发起规则设置</caption>
        <tr>
            <td colspan="1">规则设置：</td>
            <td colspan="2"> 
                <select ID="DDL_BRole" name="DDL_BRole"  style="width:130px">
                <option value="0" > 不可以 </option>
                <option value="1" > 批量审批 </option>
                <option value="2" > 分组批量审核 </option>

                </select>              
            </td>
            <td><a href="http://ccbpm.mydoc.io/?v=5404&t=17920" target="_blank">帮助</a> </td>
        </tr>
         <tr>
            <td colspan="1">显示的行数：</td>

            <td colspan="2">
                <input type="text" value="12" ID="TB_BatchListCount" name="TB_BatchListCount" runat="server" style="width:56px" />
            </td>

            <td> 0表示显示所有</td>
            </tr>
        <tr>
            <td class="Sum" colspan="4">
                批量发起字段(需要填写的字段.)
            </td>
        </tr>


        <tr> 
        <td colspan="4"> 

        <table style=" width:100%;" id="table1">
         <tr>
            <th>序</th>
            <th>字段</th>
            <th>名称 </th>
            <th>类型</th>
        </tr>
        

        </table>

        </td>
        </tr>
       
        <tr>
            <td colspan="4">
                <input type="button" ID="Btn_Save" runat="server" value="保存" onclick="Btn_Save_Click()" />
            </td>
        </tr>
    </table>

</form>

</body>
</html>
